-----------------------------
--get random number
-----------------------------
function get_random(n1,n2)

	local t1= os.time()
	local t2= tonumber(Game.Time())
	local t3 = t1/t2
	local t = math.floor(t3)
	math.randomseed(t)
	local ret = math.random(n1,n2)
	return ret
end
--------------------------------------------------------
-- Determine how many Might runes the hero currently has
--------------------------------------------------------
function get_rune_count_might()
	return tonumber(Logic.hero_lu_item("rune_might","count"))
end

-------------------------------------------------------
-- Determine how many Mind runes the hero currently has
-------------------------------------------------------
function get_rune_count_mind()
	return tonumber(Logic.hero_lu_item("rune_mind","count"))
end

--------------------------------------------------------
-- Determine how many Magic runes the hero currently has
--------------------------------------------------------
function get_rune_count_magic()
	return tonumber(Logic.hero_lu_item("rune_magic","count"))
end

function get_rune_count_total()
   return get_rune_count_might()+get_rune_count_mind()+get_rune_count_magic()
end

function get_gold_count()
   return Logic.hero_lu_item("money","count")
end

--------------------------------------------------------
-- Determine how many crystals the hero currently has
--------------------------------------------------------
function get_crystal_count()
	return Logic.hero_lu_item("crystals","count")
end

--------------------------------------------------------------
-- Determine whether the hero can afford the price in question
--------------------------------------------------------------
function can_hero_afford_this_much ( price )
	if price > Logic.hero_lu_item("money","count") then
		return false
	end
	return true
end

---------------------------------------------------
--Determine army of hero currently has
function get_army_table(army,max)
    local tb1,tb2 = {},{}
    for i=1,max do
        local atom, count = Logic.army_get(army, i)
		tb1[i] = atom
		tb2[i] = count
	end
	return tb1,tb2
end

function get_army_slot()
	local army_slot = {}
    for i=1,5 do
		local atom, count = Logic.army_get(Logic.hero_lu_army(), i)
		if count > 0 then
		    army_slot[i]=true
		else
			army_slot[i]=false
		end
	end
	return army_slot
end

function get_army_unit_num()
	local n = 0
    for i=1,5 do
		local atom, count = Logic.army_get(Logic.hero_lu_army(), i)
		if count > 0 then
		     n = n + 1
		end
	end
	return n
end

function get_unit_total_count ( unit_type )
	local total_unit_count = 0
	local army_atom,army_count = get_army_table(Logic.hero_lu_army(),5)
	for i in pairs(army_atom) do
		if army_count[i] > 0 then
			if army_atom[i]==unit_type then
				total_unit_count = total_unit_count + army_count[i]
			end
		end
	end
	return total_unit_count
end
--[[
--------------------------------------------------------------------------
-- Determine unit atom and count in the hero's army
--------------------------------------------------------------------------
function get_unit_detail (pos)

	local army_atom,army_count = get_army_table(Logic.hero_lu_army(),5)
	for i in pairs(army_atom)
		if i == pos then
			return army_atom[i],army_count[i]
		end
	end
end
--]]
---------------------------------------
-- Determine the price of a single unit
---------------------------------------
function get_unit_price ( unit_type )
	local unit_price = 0
	--*************** Humans (including neutrals humanoid) ********************
	if unit_type ~= nil and unit_type ~= "" and unit_type ~= "nil" and unit_type ~= "empty" then
		if unit_type == "peasant" then
			unit_price=15
		elseif unit_type == "footman" then
			unit_price=105
		elseif unit_type == "goldchampion" then
			unit_price=75
		elseif unit_type == "footman2" then
			unit_price=200
		elseif unit_type== "pirat" then
			unit_price=75
		elseif unit_type== "pirat2" then
			unit_price=160
		elseif unit_type == "robber" then
			unit_price=75
		elseif unit_type == "robber2" then
			unit_price=100
		elseif unit_type == "barbarian" then
			unit_price=90
		elseif unit_type == "barbarian2" then
			unit_price=105
		elseif unit_type == "bowman" then
			unit_price=150
		elseif unit_type == "priest" then
			unit_price=150
		elseif unit_type == "priest2" then
			unit_price=480
		elseif unit_type == "archmage" then
			unit_price=1350
		elseif unit_type == "firemage" then
			unit_price=1800
		elseif unit_type == "knight" then
			unit_price=1600
		elseif unit_type == "horseman" then
			unit_price=1700
		elseif unit_type == "paladin" then
			unit_price=2400
                elseif unit_type == "runemage" then
			unit_price=18000
                elseif unit_type == "gaea" then
			unit_price=22500
                elseif unit_type == "cabalist" then
			unit_price=4000
                elseif unit_type == "witch_hunter" then
			unit_price=600
                elseif unit_type == "assassin" then
			unit_price=1200
                elseif unit_type == "battlemage" then
			unit_price=4000
                elseif unit_type == "crusader" then
			unit_price=25000
                elseif unit_type == "champion" then
			unit_price=2800
                elseif unit_type == "blademaster" then
			unit_price=22000
		--***************Neutrals ********************
                elseif unit_type == "evil_book" then
			unit_price=1200
                elseif unit_type == "gorgon" then
			unit_price=1500
                elseif unit_type == "mistik" then
			unit_price=2400                
                elseif unit_type == "udalan" then
			unit_price=9000
                elseif unit_type == "troll" then
			unit_price=6600
		elseif unit_type == "cyclop" then
			unit_price=8500
		elseif unit_type == "zcyclop" then
			unit_price=17000
		--***************Lizard (including conjurer)********************
                elseif unit_type == "gorguana2" then
			unit_price=600
                elseif unit_type == "gorguana" then
			unit_price=280
                elseif unit_type == "gorguana_elder" then
			unit_price=2100
                elseif unit_type == "gorguana_council" then
			unit_price=2800
                elseif unit_type == "tirex" then
			unit_price=20000
                elseif unit_type == "gobot" then
			unit_price=30
                elseif unit_type == "gobot2" then
			unit_price=45
                elseif unit_type == "highterrant" then
			unit_price=800
                elseif unit_type == "brontor" then
			unit_price=1950
                elseif unit_type == "chosha" then
			unit_price=1650
                elseif unit_type == "astrasz" then
			unit_price=24000
                elseif unit_type == "conjurer" then
			unit_price=3600
		--*************** Dragons And Phoenix ********************
                elseif unit_type == "phoenix2" then
			unit_price=35000
                elseif unit_type == "icedragon" then
			unit_price=22000
		elseif unit_type == "greendragon" then
			unit_price=18000
		elseif unit_type == "reddragon" then
			unit_price=21000
		elseif unit_type == "blackdragon" then
			unit_price=30000
		elseif unit_type == "fairydragon" then
			unit_price=24000
		--*************** Elves ********************
		elseif unit_type == "elf" then
			unit_price=360
		elseif unit_type == "elf2" then
			unit_price=1100
		elseif unit_type == "satyr" then
			unit_price=180
		elseif unit_type == "ent" then
			unit_price=1400
		elseif unit_type == "ent2" then
			unit_price=7200
		elseif unit_type == "unicorn" then
			unit_price=820
		elseif unit_type == "unicorn2" then
			unit_price=1120
		elseif unit_type == "dryad" then
			unit_price=75
		elseif unit_type == "sprite" then
			unit_price=30
		elseif unit_type == "sunny_sprite" then
			unit_price=40
		elseif unit_type == "sprite_lake" then
			unit_price=25
		elseif unit_type == "werewolf" then
			unit_price=240
		elseif unit_type == "druid" then
			unit_price=400
                elseif unit_type == "fairy" then
			unit_price=7000
                elseif unit_type == "wolf" then
			unit_price=240
		--*************** Animals And Plants********************
		elseif unit_type == "bear" then
			unit_price=280
		elseif unit_type == "bear2" then
			unit_price=360
		elseif unit_type == "bear_white" then
			unit_price=810
		elseif unit_type == "snake_green" then
			unit_price=90
		elseif unit_type == "snake" then
			unit_price=105
		elseif unit_type == "snake_royal" then
			unit_price=330
		elseif unit_type == "thorn" then
			unit_price=15
		elseif unit_type == "thorn_warrior" then
			unit_price=15
		elseif unit_type == "kingthorn" then
			unit_price=2300
		elseif unit_type == "monstera" then
			unit_price=4000
		elseif unit_type == "beholder" then
			unit_price=700
		elseif unit_type == "beholder2" then
			unit_price=1000
		elseif unit_type == "spider" then
			unit_price=36
		elseif unit_type == "spider_fire" then
			unit_price=90
		elseif unit_type == "spider_venom" then
			unit_price=30
		elseif unit_type == "devilfish" then
			unit_price=30
		elseif unit_type == "dragonfly_lake" then
			unit_price=22
		elseif unit_type == "dragonfly_fire" then
			unit_price=25
		elseif unit_type == "graywolf" then
			unit_price=90
		elseif unit_type == "hyena" then
			unit_price=60
		elseif unit_type == "griffin" then
			unit_price=390
		elseif unit_type == "griffin_cursed" then
			unit_price=2100
                elseif unit_type == "griffin2" then 
			unit_price=1900

		--*************** Undead ********************
		elseif unit_type == "spider_undead" then
			unit_price=22
		elseif unit_type == "skeleton" then
			unit_price=30
		elseif unit_type == "fireskeleton" then
			unit_price=150
		elseif unit_type == "venskeleton" then
			unit_price=150
		elseif unit_type == "glaskeleton" then
			unit_price=165
		elseif unit_type == "archer" then
			unit_price=36
		elseif unit_type == "zombie" then
			unit_price=90
		elseif unit_type == "zombie2" then
			unit_price=120
		elseif unit_type == "vampire" then
			unit_price=320
		elseif unit_type == "vampire2" then
			unit_price=1000
		elseif unit_type == "bat" then
			unit_price=320
		elseif unit_type == "bat2" then
			unit_price=1000
		elseif unit_type == "ghost" then
			unit_price=320
		elseif unit_type == "ghost2" then
			unit_price=650
		elseif unit_type == "bonedragon" then
			unit_price=10000
		elseif unit_type == "necromant" then
			unit_price=1500
		elseif unit_type == "blackknight" then
			unit_price=1800
                elseif unit_type == "pirat_ghost" then
			unit_price=450
		elseif unit_type == "darkmage" then
			unit_price=1800
		elseif unit_type == "evilgenius" then
			unit_price=2000
                elseif unit_type == "spiritist" then
			unit_price=2300
                elseif unit_type == "driad" then
			unit_price=175
                elseif unit_type == "dread_eye" then
			unit_price=2700
                elseif unit_type == "sinister" then
			unit_price=4800
                elseif unit_type == "darkknight" then
			unit_price=14000
		--*************** Dwarves (including mechs)********************
		elseif unit_type == "miner" then
			unit_price=60
		elseif unit_type == "dwarf" then
			unit_price=330
		elseif unit_type == "cannoner" then
			unit_price=1400
		elseif unit_type == "alchemist" then
			unit_price=1650
		elseif unit_type == "giant" then
			unit_price=12500
                elseif unit_type == "droideka" then
			unit_price=400
                elseif unit_type == "droideka_guard" then
			unit_price=600
                elseif unit_type == "miner2" then
			unit_price=900
                elseif unit_type == "ingineer" then
			unit_price=2300
                elseif unit_type == "lsma_023" then
			unit_price=4500
                elseif unit_type == "thunderbird" then
			unit_price=3600
		--*************** Orcs ********************
		elseif unit_type == "orc" then
			unit_price=300
		elseif unit_type == "orc2" then
			unit_price=700
		elseif unit_type == "goblin" then
			unit_price=120
		elseif unit_type == "goblin2" then
			unit_price=135
		elseif unit_type == "catapult" then
			unit_price=630
		elseif unit_type == "shaman" then
			unit_price=1200
		elseif unit_type == "ogre" then
			unit_price=6000
                elseif unit_type == "goblin_shaman" then
			unit_price=650
                elseif unit_type == "shaman_blood" then
			unit_price=1500
                elseif unit_type == "orc_hunter" then
			unit_price=800
                elseif unit_type == "orc_saboteur" then
			unit_price=900
                elseif unit_type == "ogre_chieftain" then
			unit_price=7000
		--*************** Demons(including demonologist) ********************
		elseif unit_type == "imp" then
			unit_price=120
		elseif unit_type == "imp2" then
			unit_price=180
		elseif unit_type == "cerberus" then
			unit_price=360
		elseif unit_type == "demoness" then
			unit_price=1050
		elseif unit_type == "demon" then
			unit_price=1800
		elseif unit_type == "archdemon" then
			unit_price=13000
                elseif unit_type == "demon2" then
			unit_price=2400
                elseif unit_type == "dictator" then
			unit_price=6000
                elseif unit_type == "banshee" then
			unit_price=1800
                elseif unit_type == "malcanthet" then
			unit_price=22000
                elseif unit_type == "demonologist" then
			unit_price=2000
                elseif unit_type == "infernodragon2" then
			unit_price=25000
		--************** Lizardeads *********************
                elseif unit_type == "gorguana_avenger" then
			unit_price=480
                elseif unit_type == "gorguana_spirit" then
			unit_price=800
                elseif unit_type == "undead_gobot" then
			unit_price=100
                elseif unit_type == "undead_brontor" then
			unit_price=2700
                elseif unit_type == "winged_shade" then
			unit_price=1200
                elseif unit_type == "necrox" then
			unit_price=28000
               	--************** new unit at 2012 0615 *********************
                elseif unit_type == "angle" then
			unit_price=150000
                elseif unit_type == "batty" then
			unit_price=30
                elseif unit_type == "rainbowfly" then
			unit_price=650 
                elseif unit_type == "sleipnir" then
			unit_price=16000 
                elseif unit_type == "sylph" then
			unit_price=35000 
                elseif unit_type == "thorn_hell" then
			unit_price=750
                elseif unit_type == "undine" then
			unit_price=25000 


		end
	end
	return tonumber(unit_price)
end

--------------------------------------------------------------
-- Determine whether the hero can afford the price in question
--------------------------------------------------------------
function can_hero_afford_this_much ( price )
	if price > Logic.hero_lu_item("money","count") then
		return false
	end
	return true
end

-------------------------------------------------------------
-- Determine whether the selected army can be upgraded or not
-------------------------------------------------------------
function can_unit_be_upgraded(unit_type)
	return
		unit_type == "footman" or
		unit_type == "bowman" or
		unit_type == "orc" or
		unit_type == "orc2" or
		unit_type == "orc_hunter" or
		unit_type == "orc_saboteur" or
		unit_type == "ogre" or
		unit_type == "troll" or
		unit_type == "cyclop" or
		unit_type == "elf" or
		unit_type == "zombie" or
		unit_type == "zombie2" or
		unit_type == "archer" or
		unit_type == "skeleton" or
		unit_type == "fireskeleton" or
		unit_type == "glaskeleton" or
		unit_type == "vampire" or
		unit_type == "vampire2" or
		unit_type == "pirat" or
		unit_type == "pirat2" or
		unit_type == "beholder" or
		unit_type == "beholder2" or
		unit_type == "gorgon" or
		unit_type == "dread_eye" or
		unit_type == "sinister" or
		unit_type == "bear" or
		unit_type == "bear2" or
		unit_type == "ghost" or
		unit_type == "ghost2" or
		unit_type == "necromant" or
		unit_type == "darkmage" or
		unit_type == "evil_book" or
		unit_type == "ent" or
		unit_type == "robber" or
		unit_type == "robber2" or
		unit_type == "witch_hunter" or
		unit_type == "barbarian" or
		unit_type == "imp" or
		unit_type == "imp2" or
		unit_type == "cerberus" or
		unit_type == "unicorn" or
		unit_type == "demon" or
		unit_type == "demon2" or
		unit_type == "dictator" or
		unit_type == "snake" or
		unit_type == "priest" or
		unit_type == "priest2" or
		unit_type == "peasant" or
		unit_type == "footman2" or
		unit_type == "thorn" or
		unit_type == "kingthorn" or
		unit_type == "miner" or
		unit_type == "dwarf" or
		unit_type == "miner2" or
		unit_type == "alchemist" or
		unit_type == "evilgenius" or
		unit_type == "goblin" or
		unit_type == "goblin2" or
		unit_type == "goblin_shaman" or
		unit_type == "shaman" or
		unit_type == "shaman_blood" or
		unit_type == "knight" or
		unit_type == "sprite_lake" or
		unit_type == "sunny_sprite" or
		unit_type == "dryad" or
		unit_type == "driad" or
		unit_type == "fairy" or
		unit_type == "druid" or
		unit_type == "demonologist" or
		unit_type == "archmage" or
		unit_type == "firemage" or
                unit_type == "cabalist" or
		unit_type == "demoness" or
		unit_type == "banshee" or
		unit_type == "gobot" or
		unit_type == "undead_gobot" or
		unit_type == "gobot2" or
		unit_type == "gorguana" or
		unit_type == "gorguana2" or
		unit_type == "gorguana_avenger" or
		unit_type == "gorguana_spirit" or
		unit_type == "gorguana_elder" or
                unit_type == "brontor" or
                unit_type == "undead_brontor" or
                unit_type == "highterrant" or
                unit_type == "chosha" or
                unit_type == "tirex" or
		unit_type == "dragonfly_lake" or
		unit_type == "dragonfly_fire" or
                unit_type == "griffin" or
                unit_type == "griffin2" or
                unit_type == "griffin_cursed" or
                unit_type == "thunderbird" or
                unit_type == "bonedragon" or
                unit_type == "droideka" or
                unit_type == "droideka_guard" or
                unit_type == "blackknight" or
                unit_type == "horseman" or
                unit_type == "paladin"
end

-------------------------------------------------------------------------------
-- Determine how army upgrade parameters (type, original price, upgraded price)
-------------------------------------------------------------------------------
function get_upgrade_path (unit_type)
	local unit_type_new=""
	local price_original=0
	local price_upgraded=0

	if can_unit_be_upgraded(unit_type) == true then
		if unit_type == "footman" then
			unit_type_new = "footman2"

		elseif unit_type == "bowman" then
			unit_type_new = "elf"

		elseif unit_type == "elf" then
			unit_type_new = "elf2"

		elseif unit_type == "sprite_lake" then
			unit_type_new = "sunny_sprite"

		elseif unit_type == "sunny_sprite" then
			unit_type_new = "dryad"

		elseif unit_type == "dryad" then
			unit_type_new = "driad"

		elseif unit_type == "driad" then
			unit_type_new = "fairy"

		elseif unit_type == "fairy" then
			unit_type_new = "gaea"

		elseif unit_type == "druid" then
			unit_type_new = "demonologist"

		elseif unit_type == "demonologist" then
			unit_type_new = "battlemage"

		elseif unit_type == "elf" then
			unit_type_new = "elf2"

		elseif unit_type == "archer" then
			unit_type_new = "fireskeleton"

		elseif unit_type == "fireskeleton" then
			unit_type_new = "ghost"

		elseif unit_type == "skeleton" then
			unit_type_new = "glaskeleton"

		elseif unit_type == "glaskeleton" then
			unit_type_new = "vampire"

		elseif unit_type == "zombie" then
			unit_type_new = "zombie2"

		elseif unit_type == "vampire" then
			unit_type_new = "vampire2"

		elseif unit_type == "vampire2" then
			unit_type_new = "blackknight"

		elseif unit_type== "pirat" then
			unit_type_new = "pirat2"

		elseif unit_type== "evil_book" then
			unit_type_new = "udalan"

		elseif unit_type== "pirat2" then
			unit_type_new = "pirat_ghost"

		elseif unit_type == "beholder" then
			unit_type_new = "beholder2"

		elseif unit_type == "beholder2" then
			unit_type_new = "gorgon"

		elseif unit_type == "gorgon" then
			unit_type_new = "mistik"
		
                elseif unit_type == "dread_eye" then
			unit_type_new = "sinister"

                elseif unit_type == "sinister" then
			unit_type_new = "bonedragon"

		elseif unit_type == "orc" then
			unit_type_new = "orc2"

		elseif unit_type == "orc2" then
			unit_type_new = "orc_hunter"

		elseif unit_type == "orc_hunter" then
			unit_type_new = "orc_saboteur"

		elseif unit_type == "orc_saboteur" then
			unit_type_new = "ogre"

		elseif unit_type == "ogre" then
			unit_type_new = "troll"

		elseif unit_type == "troll" then
			unit_type_new = "ogre_chieftain"

		elseif unit_type == "ghost" then
			unit_type_new= "ghost2"

		elseif unit_type == "ghost2" then
			unit_type_new= "necromant"

		elseif unit_type == "necromant" then
			unit_type_new= "darkmage"

		elseif unit_type == "darkmage" then
			unit_type_new= "dread_eye"

		elseif unit_type == "bear" then
			unit_type_new = "bear2"

		elseif unit_type == "bear2" then
			unit_type_new = "bear_white"

		elseif unit_type == "ent" then
			unit_type_new = "ent2"

		elseif unit_type == "robber" then
			unit_type_new = "robber2"

		elseif unit_type == "robber2" then
			unit_type_new = "witch_hunter"

		elseif unit_type == "witch_hunter" then
			unit_type_new = "assassin"

		elseif unit_type == "barbarian" then
			unit_type_new = "barbarian2"

		elseif unit_type == "droideka" then
			unit_type_new = "droideka_guard"

		elseif unit_type == "droideka_guard" then
			unit_type_new = "lsma_023"

		elseif unit_type == "imp" then
			unit_type_new = "imp2"

		elseif unit_type == "imp2" then
			unit_type_new = "cerberus"

		elseif unit_type == "cerberus" then
			unit_type_new = "demon"

		elseif unit_type == "goblin" then
			unit_type_new = "goblin2"

		elseif unit_type == "goblin2" then
			unit_type_new = "goblin_shaman"

		elseif unit_type == "goblin_shaman" then
			unit_type_new = "shaman"

		elseif unit_type == "shaman" then
			unit_type_new = "shaman_blood"

		elseif unit_type == "shaman_blood" then
			unit_type_new = "spiritist"

		elseif unit_type == "unicorn" then
			unit_type_new = "unicorn2"

		elseif unit_type == "demon" then
			unit_type_new = "demon2"

		elseif unit_type == "demon2" then
			unit_type_new = "dictator"

		elseif unit_type == "dictator" then
			unit_type_new = "archdemon"

		elseif unit_type == "snake" then
			unit_type_new = "snake_royal"

		elseif unit_type == "griffin" then
			unit_type_new = "griffin2"

		elseif unit_type == "griffin2" then
			unit_type_new = "griffin_cursed"

		elseif unit_type == "griffin_cursed" then
			unit_type_new = "thunderbird"

		elseif unit_type == "thunderbird" then
			unit_type_new = "phoenix2"

		elseif unit_type == "priest" then
		    unit_type_new = "priest2"

		elseif unit_type == "priest2" then
			unit_type_new = "archmage"

		elseif unit_type == "archmage" then
			unit_type_new = "firemage"

		elseif unit_type == "firemage" then
			unit_type_new = "cabalist"

		elseif unit_type == "cabalist" then
			unit_type_new = "runemage"

		elseif unit_type == "peasant" then
			unit_type_new = "footman"

		elseif unit_type == "footman2" then
			unit_type_new = "knight"

		elseif unit_type == "thorn" then
			unit_type_new = "kingthorn"

		elseif unit_type == "kingthorn" then
			unit_type_new = "monstera"

		elseif unit_type == "miner" then
			unit_type_new = "dwarf"

		elseif unit_type == "dwarf" then
			unit_type_new = "miner2"

		elseif unit_type == "miner2" then
			unit_type_new = "giant"

		elseif unit_type == "alchemist" then
			unit_type_new = "evilgenius"

		elseif unit_type == "evilgenius" then
			unit_type_new = "ingeneer"

		elseif unit_type == "knight" then
			unit_type_new = "paladin"

		elseif unit_type == "paladin" then
			unit_type_new = "crusader"

		elseif unit_type == "archmage" then
			unit_type_new = "cabalist"

		elseif unit_type == "demoness" then
			unit_type_new = "banshee"

		elseif unit_type == "banshee" then
			unit_type_new = "malcanthet"

		elseif unit_type == "gobot" then
			unit_type_new = "gobot2"

		elseif unit_type == "gobot2" then
			unit_type_new = "undead_gobot"

		elseif unit_type == "undead_gobot" then
			unit_type_new = "brontor"

		elseif unit_type == "brontor" then
			unit_type_new = "undead_brontor"

		elseif unit_type == "undead_brontor" then
			unit_type_new = "tirex"

		elseif unit_type == "tirex" then
			unit_type_new = "necrox"

		elseif unit_type == "gorguana" then
			unit_type_new = "gorguana_avenger"

		elseif unit_type == "gorguana2" then
			unit_type_new = "gorguana_spirit"

		elseif unit_type == "gorguana_avenger" then
			unit_type_new = "gorguana_council"

		elseif unit_type == "gorguana_spirit" then
			unit_type_new = "gorguana_elder"

		elseif unit_type == "gorguana_elder" then
			unit_type_new = "conjurer"

		elseif unit_type == "highterrant" then
			unit_type_new = "winged_shade"

		elseif unit_type == "chosha" then
			unit_type_new = "astrasz"

		elseif unit_type == "dragonfly_lake" then
		    unit_type_new = "greendragon"

		elseif unit_type == "dragonfly_fire" then
		    unit_type_new = "reddragon"

		elseif unit_type == "bonedragon" then
		    unit_type_new = "infernodragon2"

		elseif unit_type == "horseman" then
		    unit_type_new = "champion"

		elseif unit_type == "blackknight" then
		    unit_type_new = "darkknight"

		elseif unit_type == "cyclop" then
		    unit_type_new = "zcyclop"
		end

		price_original=get_unit_price(unit_type)
		price_upgraded=get_unit_price(unit_type_new)
	end

	return unit_type_new, price_original, price_upgraded
end
